Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 8 Forum

Notes/Domino 8 Forum

Previous Next
Subject: LS to SQL - Can read, but not update?
Feedback Type: Question
Product Area: Domino Server
Technical Area: Application development
Platform: Windows XP client
Release: All
Reproducible: Always

Hi

I've used some code from the Designer help file (posted below) to be able to connect to an SQL server. I can easily read the table in, but if I try and update it, I get an error.

Has anyone seen this before - and since I'm completely new to doing this can anyone see any rookie mistakes??


Thanks in advance,

Paul.

Sub Initialize
On Error Goto trap
Dim ses As New Lcsession
' In an LEI Scripted Agent, use the following syntax instead:
' Dim session As New LCSession ("mySession")
Dim con As New Lcconnection("oledb")
con.provider = "SQLOLEDB" ' use SQL Data
con.server = "DEVTEST"
con.database = "Outbound"
con.metadata = "ProjectDetail"
con.userid = "----"
con.password = "----"
con.Connect
Dim confldlst As New Lcfieldlist, count As Long
Dim TRID As LCField, USERI As LCField

con.writeback = True
count = con.Select(Nothing, 1, confldlst)
' Get a "handle" to each of the fields in the list returned by Selection.
Set TRID = confldlst.GetField(1) ' locate field by position
Set USERI = confldlst.GetField(5) ' locate field by position


While (con.Fetch (conFldLst) > 0)
Print "TID=" & TRID.Text(0) & ", User ID=" & USERI.Text(0)
' If this dog's name is Tracy, change it to Tyler.
If USERI.text(0) = "Admin2" Then
USERI.text = "Admin1"
' Now write the change back to the database.
Call con.Update(confldlst)
Print "Changed User ID."
End If
Print "<br>"
Wend
con.Action(LCACTION_COMMIT)
con.Disconnect
Exit Sub
trap:
Dim stat$, errcode As Long, msg$
If ses.Status <> LCSUCCESS Then
ses.Getstatus stat, errcode, msg
If (ses.Status = LCFAIL_EXTERNAL)Then
Print "ODBC message: " & msg & " code #" & Cstr(errcode), 0, _
"error number " & Err & " line " & Erl
Else
Print "Connector message: " & Text, 0, "error number " & _
Err & " line " & Erl
End If
Else
Print Error, 0, "error number " & Err & " line " & Erl
End If
con.Disconnect
Exit Sub
End Sub


Feedback number WEBB8A8H7V created by ~Lisa Elreterobu on 10/14/2010

Status: Open
Comments:

LS to SQL - Can read, but not updat... (~Lisa Elreterob... 14.Oct.10)
. . SQL error (~Michelle Asafr... 14.Oct.10)
. . . . Error Information (~Lisa Elreterob... 15.Oct.10)
. . . . . . Code Sample (~Michelle Asafr... 15.Oct.10)
. . . . . . . . Sorted! (~Lisa Elreterob... 19.Oct.10)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS